<?php
namespace app\index\validate;
use think\Validate;

class User extends Validate {
    protected  $rule = [
        ['username', 'require|/^[A-Za-z0-9]+$/', '用户名不能为空|用户名必须为字母或数字'],
        ['email','email'],
        ['password', 'require'],
        ['name', 'require'],
        ['tel', 'require'],
        ['pro', 'require'],
        ['city', 'require'],
        ['county', 'require'],
        ['address', 'require'],
    ];

    /**场景设置**/
    protected  $scene = [
        'add' => ['name', 'parent_id', 'id'],// 添加
        'listorder' => ['id', 'listorder'], //排序
        'status' => ['id', 'status'],
        'register' => ['username', 'email', 'password'],// 添加   
       'address' => ['name', 'tel', 'pro', 'city', 'county', 'address'],// 添加   
    ];
}